<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>漂浮的幽灵</title>
		<style>
			* {
				margin: 0;
				padding: 0;
			}
			body {
				display: flex;
				justify-content: center;
				align-items: center;
				height: 100vh;
				background-color: #00034b;
			}
			.container .ghost {
				position: relative;
				width: 150px;
				height: 225px;
				border-radius: 75px 75px 0 0;
				background-color: #fff;
				box-shadow: -17px 0 0 #dbdbdb inset, 0 0 50px #5939db;
				animation: ghost 2s infinite;
			}
			/* 眼睛 */
			.container .ghost .ghostEyes {
				display: flex;
				/* 元素平均分配宽度 */
				justify-content: space-around;
				width: 90px;
				padding-top: 70px;
				margin: 0 auto;
			}
			/* 利用两个伪元素做眼睛 */
			.container .ghost .ghostEyes::before,
			.container .ghost .ghostEyes::after {
				content: "";
				width: 15px;
				height: 25px;
				border-radius: 50%;
				background-color: #00034b;
			}
			/* 腮红 */
			.container .ghost .ghostDimples {
				display: flex;
				justify-content: space-around;
				width: 130px;
				padding-top: 15px;
				margin: 0 auto;
			}
			.container .ghost .ghostDimples::before,
			.container .ghost .ghostDimples::after {
				content: "";
				width: 15px;
				height: 15px;
				border-radius: 50%;
				background-color: #ffbeff;
			}
			/* 脚  */
			.container .ghost .ghostFeet {
				/* 4只脚水平排列 */
				display: flex;
				position: absolute;
				bottom: -13px;
				width: 100%;
			}
			.container .ghost .ghostFeet .ghostFoot {
				width: 25%;
				height: 26px;
				border-radius: 50%;
				background-color: #fff;
			}
			/* 设置最后一只脚让他跟身体的阴影一样 */
			.container .ghost .ghostFeet .ghostFoot:last-child {
				/* 利用背景渐变色实现 */
				background-image: linear-gradient(to right, #fff 55%, #dbdbdb 45%);
			}
			/* 阴影 */
			.container .shadow {
				width: 150px;
				height: 40px;
				margin-top: 50px;
				border-radius: 50%;
				background-color: #000232;
				animation: shadow 2s infinite;
			}
			/* 浮动动画 */
			@keyframes ghost {
				0%,
				100% {
					transform: translateY(0);
				}
				50% {
					/* 向上走15px */
					transform: translateY(-15px);
				}
			}
			@keyframes shadow {
				0%,
				100% {
					transform: scale(1);
				}
				50% {
					transform: scale(0.8);
				}
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div class="ghost">
				<div class="ghostEyes"></div>
				<div class="ghostDimples"></div>
				<div class="ghostFeet">
					<div class="ghostFoot"></div>
					<div class="ghostFoot"></div>
					<div class="ghostFoot"></div>
					<div class="ghostFoot"></div>
				</div>
			</div>
			<div class="shadow"></div>
		</div>
	</body>
</html>
